package com.sunsys;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;


public class UserDAO {
	public boolean login(String userName,String password) {
		ResultSet rs = null;
		try {
			DBConnection connection = new DBConnection();
			Connection con = connection.makeDBConnection();
			String sql = "select * from users where username=\'"+userName+"\' and password=\'"+password +"\'";
			Statement statement = con.createStatement();
			rs = statement.executeQuery(sql);
			while(rs.next()) {
				String name = rs.getString(1);
				String pass = rs.getString(2);
			}
			con.close();
		}
		catch(Exception e) {
			e.printStackTrace();
		}
		if(rs!=null && userName!="" && password!="") {
			return true;
		}
		else
			return false;
	}
		
}

